import request from '@/utils/request'

/**
 * 查询权益类别列表
 * http://192.168.88.247:4999/web/#/80
 * @param {*} query 查询条件
 * @returns
 */
export function listRightPackage (data) {
  return request({
    url: '/v1/right_package/list',
    method: 'post',
    data
  })
}

/**
 * 权限类别下拉选择
 * @returns
 */
// export function getRightTypeOption () {
//   return request({
//     url: '/v1/righttype/getid',
//     method: 'get'
//   })
// }

/**
 * 新增权益类别
 * http://192.168.88.247:4999/web/#/80
 * @param {*} data
 * @returns
 */
export function addRightPackage (data) {
  return request({
    url: '/v1/right_package/create',
    method: 'post',
    data: data
  })
}

/**
 * 修改权益类别
 * http://192.168.88.247:4999/web/#/80
 * @param {*} data
 * @returns
 */
export function updateRightPackage (data) {
  return request({
    url: '/v1/right_package/update',
    method: 'put',
    data: data
  })
}

/**
 * 删除权益类别
 * http://192.168.88.247:4999/web/#/80
 * @param {*} id 类别ID
 * @returns
 */
export function delRightPackage (id) {
  return request({
    url: '/v1/right_package/del',
    method: 'delete',
    data: { id }
  })
}

// 权益包上架
export function updateStatus (id) {
  return request({
    url: '/v1/right_package/shelf',
    method: 'post',
    data: { id }
  })
}
/**
 * 获取权益包类型
 * http://192.168.88.247:4999/web/#/80/1134
 * @returns
 */
export function getPackageId (params) {
  return request({
    url: '/admin-api/api/v1/dict/datalist',
    method: 'get',
    params
  })
}

/**
 * 查询权益包列表（包含项目归属字段）
 * http://192.168.88.247:4999/web/#/80/1835
 * @param {*} params
 * @returns
 */
export function getRightPackage (params) {
  return request({
    url: '/v1/right_package/in_appid',
    params
  })
}
